JAVA = java

JAVAC = javac

COMP_FLAGS = -g -O

RUN_FLAGS = -green

JSDATABASE = jsdatabase

IMETHOD = true
ICONSTRUCTOR = true
IBRANCH = true
ISWITCH = true
ICATCH = true
IBASICBLOCK = true 
ILOGICAL = true
IRELATIONAL = true
IPRODUCTION = false
IEXPANSION = false

JSINSTR = jsinstr
JSINSTRFLAGS = -IFLUSHCLASS=true -IDATABASE=$(JSDATABASE) \
		-RDATABASE=$(JSDATABASE) -IMETHOD=$(IMETHOD) \
		-ICONSTRUCTOR=$(ICONSTRUCTOR) -IBRANCH=$(IBRANCH) \
		-ISWITCH=$(ISWITCH) -ICATCH=$(ICATCH) \
		-IBASICBLOCK=$(IBASICBLOCK) -ILOGICAL=$(ILOGICAL) \
		-IRELATIONAL=$(IRELATIONAL) -IPRODUCTION=$(IPRODUCTION) \
		-IEXPANSION=$(IEXPANSION)
JSRESTORE = jsrestore
JSSUMMARY = jssummary
JSSUMMARYFLAGS = -IDATABASE=$(JSDATABASE) \
		-RDATABASE=$(JSDATABASE) -IMETHOD=$(IMETHOD) \
		-ICONSTRUCTOR=$(ICONSTRUCTOR) -IBRANCH=$(IBRANCH) \
		-ISWITCH=$(ISWITCH) -ICATCH=$(ICATCH) \
		-IBASICBLOCK=$(IBASICBLOCK) -ILOGICAL=$(ILOGICAL) \
		-IRELATIONAL=$(IRELATIONAL) -IPRODUCTION=$(IPRODUCTION) \
		-IEXPANSION=$(IEXPANSION) \
		-OUTFILE:summary.html -HTML:true
JSMERGE = jsmerge
JSMERGEFLAGS = 

.SUFFIXES: .class .java
.java.class:
	$(JAVAC) $(COMP_FLAGS) $<

JSRCS = ATUR.java \
	MuxSyncTx.java \
	MuxSyncRx.java \
	CRCTx.java \
	CRCRx.java \
	ScramblerRx.java \
	ScramblerTx.java \
	DFT.java \
	IDFT.java \
	Demap.java \
	InterleaverRx.java \
	FECRx.java \
	FECTx.java \
	InterleaverTx.java \
	Map.java \
	Initializer.java
	
all: $(JSRCS:%.java=%.class)
	
run: $(JSRCS)
	$(JAVA) $(RUN_FLAGS) ptij.ADSL.PN.ADSL

runa: $(JSRCS)
	appletviewer -green ADSL.htm
	
cleanall:
	rm -f *class
	rm -rf jsdatabase
	rm -f summary.html

clean: 
	rm -f *.class
	
jsinstr:
	$(JSINSTR) $(JSINSTRFLAGS) $(JSRCS)
	$(MAKE) all
	
jsrestore:
	$(JSRESTORE) $(JSRCS)
	-rm -rf jsoriginal
	$(MAKE) clean
	
jssummary:
	$(JSSUMMARY) $(JSSUMMARYFLAGS)
	
jsmerge:
	(cd $(JSDATABASE); $(JSMERGE) $(JSMERGEFLAGS) *.jdd)
